<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改兽药库存')" />
	<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ncDrugs-edit" th:object="${ncDrugs}">
            <input id="drugId" name="drugId" th:field="*{drugId}"  type="hidden">
			<div class="form-group" hidden="hidden">
				<label class="col-sm-3 control-label">药品批次：</label>
				<div class="col-sm-8">
					<input id="drugCode" name="drugCode" th:field="*{drugCode}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group" hidden="hidden">
				<label class="col-sm-3 control-label">兽药名称：</label>
				<div class="col-sm-8">
					<input id="drugName" name="drugName" th:field="*{drugName}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group"  hidden="hidden">
				<label class="col-sm-3 control-label">生产厂家：</label>
				<div class="col-sm-8">
					<input id="factory" name="factory" th:field="*{factory}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group" hidden="hidden">
				<label class="col-sm-3 control-label">合格证：</label>
				<div class="col-sm-8">
					<input id="isHege" name="isHege" th:field="*{isHege}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group" hidden="hidden">
				<label class="col-sm-3 control-label" >入库时间：</label>
				<div class="col-sm-8">
					<input id="createTime" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss" name="createTime" required
						   th:value="*{#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd hh:mm:ss')}" class="form-control"
						   type="text" th:class="time-input">
				</div>
			</div>
			<div class="form-group" hidden="hidden">
				<label class="col-sm-3 control-label">库存：</label>
				<div class="col-sm-8">
					<input id="stockAmout" name="stockAmout" th:field="*{stockAmout}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group" hidden="hidden">
				<label class="col-sm-3 control-label">单位：</label>
				<div class="col-sm-8">
					<input id="unit" name="unit" th:field="*{unit}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group" hidden="hidden">
				<label class="col-sm-3 control-label">经手人：</label>
				<div class="col-sm-8">
					<select id="createBy" name="createBy" class="form-control select2-multiple" >
						<option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}" th:field="*{createBy}"></option>
					</select>
				</div>
			</div>
			<div class="form-group" hidden="hidden" >
				<label class="col-sm-3 control-label">有效期：</label>
				<div class="col-sm-8">
					<input id="validDate"  data-type="datetime" data-format="yyyy-MM-dd" name="validDate" required
						   th:value="*{#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd')}" class="form-control"
						   type="text" th:class="time-input">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">采购人：</label>
				<div class="col-sm-8">
					<select id="purchaser" name="purchaser" class="form-control select2-multiple" >
						<option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}" th:field="*{purchaser}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea rows="4" name="remark" th:field="*{remark}" class="form-control" type="text"></textarea>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">功能主治：</label>
				<div class="col-sm-8">
					<input id="mainFunction" name="mainFunction" th:field="*{mainFunction}" class="form-control" type="text">
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
	<th:block th:include="include :: select2-js" />

	<script type="text/javascript">
		var prefix = ctx + "system/ncDrugs";
		$("#form-ncDrugs-edit").validate({
            rules: {
                inputAmount: {
                    required: true,
                    digits: true
                }

            },
            messages: {
                inputAmount: "入库数必须为正整数"
            },
            focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-ncDrugs-edit').serialize());
	        }
	    }
	</script>
</body>
</html>
